home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
A-B
/
3dlib11.cpt
/
GrafSys.rel
/
Demo Sources
/
xFighter
< prev
next >
Wrap
Text File
|
1992-04-25
|
2KB
|
86 lines
program xFighterDemo1;
{ 3d GrafSys Demo Program}
{ Vers. 1.1 }
{ (c) 1992 by Christian Franz }
{ This program demonstates the use of the grafsys for simple animation using }
{ the fDrawObject command }
uses
GrafSys, Screen3D;
const
theWindowID = 400;
degree = 0.01745329; (* π/180 *)
var
theWindow: WindowPtr;
theInt: INTEGER;
thePort: Graf3DPtr;
theMaster: Graf3DPtr;
Pyramid, Cube, xFighter: GrafObjPtr;
theEvent: EventRecord;
dx, dy, dz: integer;
r: Rect;
procedure getmouserot (var dx, dy, dz: integer);
var
thePoint: point;
begin
GetMouse(thePoint);
dx := 0;
dy := 0;
dz := 0;
if (thePoint.h < thePort^.center.h) and (thePoint.v < thePort^.center.v) then (* mouse in quadrant 1 -> xrot*)
begin
dx := 5;
end;
if (thePoint.h > thePort^.center.h) and (thePoint.v < thePort^.center.v) then (* mouse in quadrant 2 -> yrot*)
begin
dy := 5;
end;
if (thePoint.h > thePort^.center.h) and (thePoint.v > thePort^.center.v) then (* mouse in quadrant 3 -> zrot*)
begin
dz := 5;
end;
if (thePoint.h < thePort^.center.h) and (thePoint.v > thePort^.center.v) then (* mouse in quadrant 4 -> idle*)
begin
end;
if button then
begin
dx := -dx;
dy := -dy;
dz := -dz;
end;
end;
begin
theWindow := GetNewWindow(theWindowID, nil, Pointer(-1));
SetPort(theWindow); (* draw in this window *)
;
{PenMode(patXOR)}
MoveTo(10, 10);
DrawString('3D Grafiksystem. Object: X-Fighter. (C) 1991 by CF.');
InitGrafSys;
NewGrafport(theWindow^.portRect, thePort);
MoveTo(10, thePort^.bottom - 0);
DrawString(' Press Button to Exit');
xFighter := GetNewNamedObject('theFighter');
SetEye(FALSE, 0, 0, 0, 0, 0, 0, 1.57079633, false);
ObjTranslate(xFighter, 0, 0, 200);
ObjRotate(xFighter, 0 * degree, 0 * degree, 0);
ObjScale(xFighter, 1, 1, 1);
SetAutoErase(xFighter, TRUE);
fDrawObject(xFighter);
repeat
GetMouseRot(dx, dy, dz);
if (dx + dy + dz <> 0) then
fDrawObject(xfighter); (* draw Object *)
ObjRotate(xFighter, dx * degree, dy * degree, dz * degree);
until Button;
end.